<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录页面</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            flex-direction: column;
        }

        table {
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 400px;
        }

        td {
            padding: 15px;
        }

        .form-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px; /* 添加行间距 */
        }

        .form-row label {
            width: 40px; /* 给标签指定固定宽度 */
            margin-right: 10px; /* 标签和输入框之间的间距 */
            text-align: right; /* 标签文本右对齐 */
        }

        .form-row input {
            width: calc(100% - 60px); /* 输入框宽度减去标签宽度和间距 */
            padding: 15px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        input[type="submit"], input[type="reset"], .btn-back {
            background-color: #007bff;
            color: white;
            border: none;
            padding: 10px 15px;
            border-radius: 5px;
            cursor: pointer;
            width: 100%;
            margin-top: 10px;
        }

        input[type="reset"] {
            background-color: #6c757d;
        }

        input[type="submit"]:hover, input[type="reset"]:hover, .btn-back:hover {
            opacity: 0.9;
        }

        #messageError {
            margin-top: 10px;
            color: red;
        }

        .btn-back {
            background-color: #28a745;
            text-align: center;
            display: block;
            width: 300px;
            margin-top: 10px;
            text-decoration: none;
            padding: 10px;
            color: white;
            border-radius: 5px;
        }

        .btn-back:hover {
            opacity: 0.9;
        }

        /* 新增的样式 */
        .btn-register {
            background-color: #17a2b8;
            text-align: center;
            display: block;
            width: 300px;
            margin-top: 10px;
            text-decoration: none;
            padding: 10px;
            color: white;
            border-radius: 5px;
        }

        .btn-register:hover {
            opacity: 0.9;
        }
    </style>
</head>
<body>
<form th:action="@{/user/login}" method="post">
    <table>
        <tr>
            <td align="center" colspan="2"><strong>登录</strong></td>
        </tr>
        <tr class="form-row">
            <td><label for="uname">用户名：</label></td>
            <td><input type="text" id="uname" name="uname" required/></td>
        </tr>
        <tr class="form-row">
            <td><label for="upwd">密码：</label></td>
            <td><input type="password" id="upwd" name="upwd" required/></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" value="提交"/>
                <input type="reset" value="重置"/>
            </td>
        </tr>
    </table>
    <div id="messageError" th:text="${errorMessage}"></div>
</form>

<!-- 返回按钮 -->
<a href="/user/index" class="btn-back">返回</a>

<!-- 去注册链接 -->
<a href="/user/register" class="btn-register">去注册</a>

</body>
</html>
